'''
做一个数据结构实现
1. 后进先出 栈
2. 先进先出 队列 利用栈实现队列
'''


class storageNo1:
    def __init__(self):
        self.stack = []

    def push(self, order):
        self.stack.append(order)

    def pop(self):
        return self.stack.pop()


class yourService:
    def __init__(self):
        self.stack1 = []
        self.stack2 = []

    def addOrder(self, order):
        self.stack1.append(order)
    # 把一个栈的数据压入另一个栈，然后pop
    def getOrder(self):
        if self.stack2 == []:
            while self.stack1:
                self.stack2.append(self.stack1.pop())
        return self.stack2.pop()



storageNo1 = storageNo1()
storageNo1.push(1)
storageNo1.push(2)
print(storageNo1.pop())
print(storageNo1.pop())

yourService=yourService()
yourService.addOrder(1)
yourService.addOrder(2)
yourService.addOrder(3)
print(yourService.getOrder())
print(yourService.getOrder())
print(yourService.getOrder())
